// import ModelFlyIcon, { FlyIconData } from './../mvc/fly_icon/model/ModelFlyIcon';
import { Loger } from "../../framework/loger/Loger";
import ViewMgr from "../../framework/view/ViewMgr";
import VCMsgBox, { MsgBoxData, MsgBoxType } from "../mvc/common/vc/VCMsgBox";
import VCTips from "../mvc/common/vc/VCTips";
import { game } from 'cc';
import { StringConst } from '../const/StringConst';
import StringUtils from '../../framework/utils/StringUtils';

export class GameUtils {

    static showMsgBox(data: MsgBoxData) {
        // let data_demo: MsgBoxData = {
        //     type: MsgBoxType.OK_CANCEL,
        //     title: "测试标题",
        //     msg: "测试弹窗",
        //     hide_btn_close: false,
        //     bg_close: true,
        //     ok_callback: () => {
        //         Loger.log("弹窗点确定")
        //     },
        //     cancel_callback: () => {
        //         Loger.log("弹窗点取消")
        //     }
        // }
        ViewMgr.getInstance().showView(VCMsgBox, data);
    }

    /**弹出退出游戏弹窗 */
    static showExitGame() {
        let data: MsgBoxData = {
            type: MsgBoxType.OK_CANCEL,
            title: StringUtils.getStr("common_ui_exit_game"),
            msg: StringUtils.getStr("common_ui_exit_game_msg"),
            btn_str_ok: StringUtils.getStr("common_ui_yes"),
            btn_str_cancel: StringUtils.getStr("common_ui_no"),
            no_back_close: true,
            ok_callback: () => {
                game.end();
            },
            cancel_callback: () => {
            }
        }
        this.showMsgBox(data);
    }

    /**打开通用tips提示 */
    static showTip(str: string) {
        ViewMgr.getInstance().showView(VCTips, { str: str });
    }
}